package com.xyw.his00.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xyw.his00.pojo.dbpojo.MedicalTechnology;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MedicalTechnologyMapper extends BaseMapper<MedicalTechnology> {
    //1.查询已开立的检查项目
    @Select("SELECT m.id,m.tech_code,m.tech_format,m.tech_price,m.price_type " +
            "FROM  medical_technology m " +
            "INNER JOIN check_request c ON(m.id=c.medical_technology_id) " +
            "WHERE c.register_id=#{registerId} AND c.check_state LIKE CONCAT('%', #{state}, '%') "+
            "ORDER BY c.creation_time ASC"
    )
    List<MedicalTechnology> selectChecksByState(int registerId,String state);


    //2.查询已开立的检验项目

    @Select("SELECT m.id,m.tech_code,m.tech_format,m.tech_price,m.price_type " +
            "FROM  medical_technology m " +
            "INNER JOIN inspection_request i ON(m.id=i.medical_technology_id) " +
            "WHERE i.register_id=#{registerId} AND i.inspection_state LIKE CONCAT('%', #{state}, '%') "+
            "ORDER BY c.creation_time ASC")
    List<MedicalTechnology> selectInspectionsByState(int registerId,String state);
}
